/**
 * 
 */
package phoenics.manpads.common.utils;

import java.util.Map;

import org.springframework.http.HttpStatus;

/**
 * @author Phoenics Chow on 2018年4月12日
 *
 */
public class StatusData {
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StatusData.class);
	private int code = -1;
	private String message = "";

	public static StatusData error() {
		return error(HttpStatus.INTERNAL_SERVER_ERROR.value(), "未知异常，请联系管理员");
	}

	public static StatusData error(String msg) {
		return error(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg);
	}

	public static StatusData error(int code, String msg) {
		return new StatusData(code, msg);
	}

	public static StatusData ok(String msg) {
		return error(0, msg);
	}

	public static StatusData ok() {
		return new StatusData();
	}

	public StatusData() {
		this.code = 0;
		this.message = "success";
	}

	public StatusData(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}
}
